CREATE PROCEDURE [dbo].[sp_cat_GetDistributor]
@Distributor varchar(50) = NULL, @PKDistributor int = NULL
AS
BEGIN
  SELECT PKDistributor , Distributor FROM CT_Distributor
  WHERE PKDistributor = COALESCE(@PKDistributor , PKDistributor)
  AND (Distributor LIKE '% '+@Distributor+'%' OR Distributor LIKE @Distributor+'%')
  ORDER BY 
    CASE 
      WHEN Distributor = @Distributor THEN 0
      WHEN Distributor LIKE @Distributor+'%' THEN 1
      ELSE 2
     END
     , Distributor;
END